//
//  ViewController.m
//  DebugDemo
//
//  Created by lzxuan on 15/9/14.
//  Copyright (c) 2015年 lzxuan. All rights reserved.
//

#import "ViewController.h"
#ifdef DEBUG
#define NSLog(...) NSLog(__VA_ARGS__)
#else
#define NSLog(...)
#endif
/**
 *
 *
 *  @param line:%d" <#line:%d" description#>
 *  @param __func__ <#__func__ description#>
 *  @param __LINE__ <#__LINE__ description#>
 *
 *  @return <#return value description#>
 */
#define kPrintDebug NSLog(@"func:%s line:%d",__func__,__LINE__)



@interface ViewController ()
{
    NSArray *_arr;
}
@end

@implementation ViewController
- (void)print{
    NSLog(@"%@",NSStringFromSelector(_cmd));//获取当前函数的的选择器  转化为 NSString类型的函数名
    NSLog(@"func:%s line:%d",__func__,__LINE__);//打印 函数名 和 当前代码的行数
    
}
//- (void)dealloc{
//    [_arr release];
//    [super dealloc];
//}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self print];
    while (1) {
        malloc(10000000);
    }
    
    NSMutableArray *mutableArr = [[NSMutableArray alloc] init];
    [mutableArr addObject:@"1"];
    
    [mutableArr release];
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.frame = CGRectMake(100, 100, 100, 50);
    [button setTitle:@"debug" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    //_arr = [@[@"one",@"two"] retain];
    _arr = @[@"one",@"two"];
}
- (void)btnClick:(UIButton *)btn {
   // NSLog(@"arr:%@",_arr[5]);
    //NSLog(@"arr:%@",_arr[0]);
    kPrintDebug;
    [self print];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
